#ifndef __DIROPS_H__
#define __DIROPS_H__

#include "object.h"
#include "util.h"

/*
  Looks for dentry named NAME in object referred to by
  DIR, and if it exists, copies it into D. (D needs to
  be allocated by the caller)
  Returns 0 in case a match is found, -ENOENT in case no match
  is found.
*/
int dentry_lookup (object *dir, const char *name, dentry *d);

/* 
  Inserts the dentry D into the directory, whose corresponding
  object is DIR. Note that DIR is changed, and it is the
  responsibility of the caller to write the object back in
  order to make the changes persistent.
  Returns 0 in case of success.
*/
int dentry_insert (object *dir, dentry *d);

/*
  Removes the dentry corresponding to NAME from the directory
  which is mapped to DIR. Note that DIR is changed, and it is
  the responsibility of the caller to write the object back in
  order to make the changes persistent.
  Returns 0 in case of success, -1 in case of failure.
*/
int dentry_delete (object *dir, const char *name);

#endif /* __DIROPS_H__ */
